/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.passive;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanReceiveTimeout;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.*;

/**
 * <b>(DianlanStubBmsFailure)</b>
 * <p>
 * GBT-27930 充电桩与 BMS 充电错误报文
 * 帧类型码 0x1B(27)
 * 序列号域 0017
 * 数据长度 36
 * 帧校验域 A2F3
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/19
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanStubBmsFailure {
    /** 交易流水号 */
    @DianlanProtocol(length = 16, start = 0, end = 16, dataType = BCD)
    String                transNo;
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 16, end = 23, dataType = BCD)
    String                stubNo;
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 23, end = 24, dataType = BCD)
    String                chargingPortNo;
    /**
     * 接收 SPN2560=0x00 的充电机辨识报文超时
     * <p>
     * <00>：=正常
     * <01>：=超时
     * <10>： =不可信状态
     */
    @DianlanProtocol(length = 2, start = 24, end = 26, dataType = ENUM)
    DianlanReceiveTimeout receive0x00Timeout;
    /** 接收 SPN2560=0xAA 的充电机辨识报文超时 */
    @DianlanProtocol(length = 2, start = 26, end = 28, dataType = ENUM)
    DianlanReceiveTimeout receive0xAaTimeout;
    /** 预留位 */
    @DianlanProtocol(length = 4, start = 28, end = 32, dataType = BIN)
    String                reservePlace;
    /** 接收充电机的时间同步和充电机最大输出能力报文超时 */
    @DianlanProtocol(length = 2, start = 32, end = 34, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeTimerSyncTimeout;
    /** 接收充电机完成充电准备报文超时 */
    @DianlanProtocol(length = 2, start = 34, end = 36, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeReadyFinishTimeout;
    /** 预留位 */
    @DianlanProtocol(length = 4, start = 36, end = 40, dataType = BIN)
    String                reservePlace2;
    /** 接收充电机充电状态报文超时 */
    @DianlanProtocol(length = 2, start = 40, end = 42, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeStatusTimeout;
    /** 接收充电机中止充电报文超时 */
    @DianlanProtocol(length = 2, start = 42, end = 44, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeSuspendTimeout;
    /** 预留位 */
    @DianlanProtocol(length = 4, start = 44, end = 48, dataType = BIN)
    String                reservePlace3;
    /** 接收充电机充电统计报文超时 */
    @DianlanProtocol(length = 2, start = 48, end = 50, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeStatTimeout;
    /** BMS 其他 */
    @DianlanProtocol(length = 6, start = 50, end = 56, dataType = ENUM)
    DianlanReceiveTimeout bmsOther;
    /** 接收 BMS 和车辆的辨识报文超时 */
    @DianlanProtocol(length = 2, start = 56, end = 58, dataType = ENUM)
    DianlanReceiveTimeout receiveBmsAndCarTimeout;
    /** 预留位 */
    @DianlanProtocol(length = 6, start = 58, end = 64, dataType = BIN)
    String                reservePlace4;
    /** 接收电池充电参数报文超时 */
    @DianlanProtocol(length = 2, start = 64, end = 66, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeParametersTimeout;
    /** 接收 BMS 完成充电准备报文超时 */
    @DianlanProtocol(length = 2, start = 66, end = 68, dataType = ENUM)
    DianlanReceiveTimeout receiveBmsChargeReadyFinishTimeout;
    /** 预留位 */
    @DianlanProtocol(length = 4, start = 68, end = 72, dataType = BIN)
    String                reservePlace5;
    /** 接收电池充电总状态报文超时 */
    @DianlanProtocol(length = 2, start = 72, end = 74, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeTimeout;
    /** 接收电池充电要求报文超时 */
    @DianlanProtocol(length = 2, start = 74, end = 76, dataType = ENUM)
    DianlanReceiveTimeout receiveBatteryChargeRequestTimeout;
    /** 接收 BMS 中止充电报文超时 */
    @DianlanProtocol(length = 2, start = 76, end = 78, dataType = ENUM)
    DianlanReceiveTimeout receiveBmsChargeSuspendTimeout;
    /** 预留位 */
    @DianlanProtocol(length = 2, start = 78, end = 80, dataType = BIN)
    String                reservePlace6;
    /** 接收 BMS 充电统计报文超时 */
    @DianlanProtocol(length = 2, start = 80, end = 82, dataType = ENUM)
    DianlanReceiveTimeout receiveBmsChargeStatTimeout;
    /** 充电机其他 */
    @DianlanProtocol(length = 6, start = 82, end = 88, dataType = ENUM)
    DianlanReceiveTimeout receiveChargeOther;
}